package com.tianji.remark.task;

import com.tianji.remark.service.ILikedRecordService;
import com.tianji.remark.service.impl.LikedRecordServiceImpl;
import lombok.RequiredArgsConstructor;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
@RequiredArgsConstructor
public class LikedTimesCheckTask {

    private static final List<String> BIZ_TYPES = List.of("QA", "NOTE");/*遍历多种业务类型，分别处理*/
    private static final int MAX_BIZ_SIZE = 30; /*每次处理的业务数量为30*/

    private final ILikedRecordService recordService;

    @Scheduled(fixedDelay = 20000) /*设置定时时间*/
    public void checkLikedTimes() {
        for (String bizType : BIZ_TYPES) {
            recordService.readLikedTimesAndSendMessage(bizType, MAX_BIZ_SIZE);
        }

    }
}
